import { Type } from 'class-transformer';
import {
  IsNotEmpty,
  IsNumber,
  IsOptional,
  IsString,
  ValidateNested,
} from 'class-validator';

export class PageDto {
  @IsNumber()
  @IsNotEmpty()
  pageNo: number;

  @IsNumber()
  @IsNotEmpty()
  pageSize: number;
}

export class QueryAccountDto {
  @IsString()
  @IsOptional()
  id: string;

  @IsString()
  @IsOptional()
  username: string;

  @IsString()
  @IsOptional()
  phoneNumber: string;
}

export class ListAccountDto {
  @ValidateNested()
  @Type(() => PageDto)
  pageDto: PageDto;

  @ValidateNested()
  @Type(() => QueryAccountDto)
  // @IsOptional()
  queryDto: QueryAccountDto;
}
